<template>
  <div>
    <el-row class="tac">
      <el-col :span="12">
        <el-menu style="margin-top: 20px;" :default-active="$route.path" collapse-transition router class="el-menu-vertical-demo"
          background-color="#000" text-color="#fff">
          <template v-for="(navData, index) in navDataList">
            <el-menu-item  :index="navData.path" v-if="navData.children <= 0"
              :key="index">
              <i :class="navData.icon"></i>
              {{ navData.title }}
            </el-menu-item>

            <el-submenu v-else :key="index" :index="index+''">
              <template slot="title">
                <i :class="navData.icon"></i>
                <span>{{ navData.title }}</span>
              </template>
              <el-menu-item-group>
                <el-menu-item  :index="navDataChildren.path"
                  v-for="(navDataChildren, index) in navData.children" :key="index">
                  <i :class="navDataChildren.icon"></i>
                  {{ navDataChildren.title }}
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </template>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import navDataList from "@/utils/navData";

export default {
  name: "NavData",
  data() {
    return {
      navDataList,

      isActive: 0,
    };
  },
  methods: {
  },
};
</script>

<style lang="scss">
.tac {
  width: 400px;
  //一定要添加！important提高优先级
  .el-menu-item.is-active{
  //设置背景颜色
    // background-color: rgb(78,118,168) !important;
    background-color: #2F89FC !important;
  //设置字体颜色
    // color: #000 !important;
  }
.el-menu-item{
      background-color: 000 !important;
        //设置字体颜色
        color: #fff !important;
}
  
}
</style>